using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class PhoneNumberMap : EntityTypeConfiguration<PhoneNumber>
    {
        public PhoneNumberMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Locale)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.BU)
                .HasMaxLength(10);

            this.Property(t => t.ChannelCode)
                .HasMaxLength(200);

            this.Property(t => t.Source)
                .HasMaxLength(200);

            this.Property(t => t.City)
                .HasMaxLength(20);

            this.Property(t => t.PhoneNumber1)
                .HasMaxLength(20);

            this.Property(t => t.ModifiedBy)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PhoneNumber");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Locale).HasColumnName("Locale");
            this.Property(t => t.BU).HasColumnName("BU");
            this.Property(t => t.ChannelCode).HasColumnName("ChannelCode");
            this.Property(t => t.Source).HasColumnName("Source");
            this.Property(t => t.City).HasColumnName("City");
            this.Property(t => t.PhoneNumber1).HasColumnName("PhoneNumber");
            this.Property(t => t.ModifiedBy).HasColumnName("ModifiedBy");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
        }
    }
}
